fix: start the close handshake for every close frame - #95
Open
nmbrone wants to merge 5 commits into
Open
Conversation
Only a close frame received from the server, or returned as `{:close, code, reason, state}`
from a callback, went through the close handshake. One sent with `Minch.send_frame/2` or
returned as `{:reply, frame, state}` was written straight to the socket: no `:close_timeout`
was armed, further frames were still accepted, and the disconnect was reported as a transport
error instead of the frame.
Every close frame now starts the handshake, whichever path it comes from. Frames that arrive
while it is in flight are still delivered to `handle_frame/2` rather than dropped, a ping is
still answered, and the connection is torn down as soon as both sides have sent a close frame
instead of waiting for the server to close the socket.
Frames sent during a handshake are rejected with the new `{:error, :closing}`.
The third way an application can start the handshake, alongside `Minch.send_frame/2` and the `{:close, code, reason, state}` callback result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only a close frame received from the server, or returned as
{:close, code, reason, state}from a callback, went through the close handshake. One sent withMinch.send_frame/2or returned as{:reply, frame, state}was written straight to the socket: no:close_timeoutwas armed, further frames were still accepted, and the disconnect was reported as a transport error instead of the frame.Every close frame now starts the handshake, whichever path it comes from. Frames that arrive while it is in flight are still delivered to
handle_frame/2rather than dropped, a ping is still answered, and the connection is torn down as soon as both sides have sent a close frame instead of waiting for the server to close the socket.Frames sent during a handshake are rejected with the new
{:error, :closing}.